package cn.zhage.aimin.canal.client.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/*
 * 
 * @author 渣哥
*/
@Data
@ConfigurationProperties(prefix = "canal")
public class CanalProperties {

    private String address;
    private String destination;
    private String subscribe;
    private int batchSize;
    private long timeout;
    private String username = "";
    private String password = "";
    private String mode;

    private Scheduler scheduler = new Scheduler();

    @Data
    public static class Scheduler{
        /**
         * 是否启用调度器
         */
        private boolean enabled = true;

        /**
         * 是否启用虚拟线程
         */
        private boolean virtualThreads = false;

        /**
         * 虚拟线程的载体线程数
         */
        private Integer poolSize;

        /**
         * 线程名前缀
         */
        private String threadNamePrefix = "Canal-";

        /**
         * 线程组名称
         */
        private String threadGroupName = "Canal-Thread-Group";



        // =================== 通用配置 ===================
        /**
         * 优雅关闭：等待任务完成
         */
        private boolean waitForTasksToCompleteOnShutdown = true;

        /**
         * 优雅关闭：等待时间（秒）
         */
        private int awaitTerminationSeconds = 30;

    }
}
